
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Developer Documentation &#8212; pyungo v0.7.0 documentation</title>
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    <script src="../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="What’s New" href="whatsnew.html" />
    <link rel="prev" title="Features" href="features.html" />
   
  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  <div class="document">
    
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<p class="logo">
  <a href="../index.html">
    <img class="logo" src="../_static/pyungo.jpg" alt="Logo"/>
    
  </a>
</p>






<p>
<iframe src="https://ghbtns.com/github-btn.html?user=cedricleroy&repo=pyungo&type=star&count=true&size=large&v=2"
  allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>





<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="gettingstarted.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="features.html">Features</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Developer Documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatsnew.html">What’s New</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../index.html">Documentation overview</a><ul>
      <li>Previous: <a href="features.html" title="previous chapter">Features</a></li>
      <li>Next: <a href="whatsnew.html" title="next chapter">What’s New</a></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="developer-documentation">
<h1>Developer Documentation<a class="headerlink" href="#developer-documentation" title="Permalink to this headline">¶</a></h1>
<dl class="py function">
<dt id="pyungo.core.topological_sort">
<code class="sig-prename descclassname">pyungo.core.</code><code class="sig-name descname">topological_sort</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.core.topological_sort" title="Permalink to this definition">¶</a></dt>
<dd><p>Topological sort algorithm</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>dict</em>) – dictionnary representing dependencies
Example: {‘a’: [‘b’, ‘c’]} node id ‘a’ depends on
node id ‘b’ and ‘c’</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>list of list of node ids</dt><dd><p>Example: [[‘a’], [‘b’, ‘c’], [‘d’]]
The sequence is representing the order to be run.
The nested lists are node ids that can be run in parallel</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>ordered (list)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>PyungoError</strong> – In case a cyclic dependency exists</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt id="pyungo.core.Node">
<em class="property">class </em><code class="sig-prename descclassname">pyungo.core.</code><code class="sig-name descname">Node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">fct</span></em>, <em class="sig-param"><span class="n">inputs</span></em>, <em class="sig-param"><span class="n">outputs</span></em>, <em class="sig-param"><span class="n">args</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">kwargs</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.core.Node" title="Permalink to this definition">¶</a></dt>
<dd><p>Node object (aka vertex in graph theory)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fct</strong> (<em>function</em>) – The Python function attached to the node</p></li>
<li><p><strong>inputs</strong> (<em>list</em>) – List of inputs (which can be <cite>Input</cite>, <cite>str</cite> or <cite>dict</cite>)</p></li>
<li><p><strong>outputs</strong> (<em>list</em>) – List of outputs (<cite>Output</cite> or <cite>str</cite>)</p></li>
<li><p><strong>args</strong> (<em>list</em>) – Optional list of args</p></li>
<li><p><strong>kwargs</strong> (<em>list</em>) – Optional list of kwargs</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>PyungoError</strong> – In case inputs have the wrong type</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt id="pyungo.core.Graph">
<em class="property">class </em><code class="sig-prename descclassname">pyungo.core.</code><code class="sig-name descname">Graph</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">inputs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">outputs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">parallel</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">pool_size</span><span class="o">=</span><span class="default_value">2</span></em>, <em class="sig-param"><span class="n">schema</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.core.Graph" title="Permalink to this definition">¶</a></dt>
<dd><p>Graph object, collection of related nodes</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> (<em>list</em>) – List of optional <cite>Input</cite> if defined separately</p></li>
<li><p><strong>outputs</strong> (<em>list</em>) – List of optional <cite>Output</cite> if defined separately</p></li>
<li><p><strong>parallel</strong> (<em>bool</em>) – Parallelism flag</p></li>
<li><p><strong>pool_size</strong> (<em>int</em>) – Size of the pool in case parallelism is enabled</p></li>
<li><p><strong>schema</strong> (<em>dict</em>) – Optional JSON schema to validate inputs data</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ImportError will raise in case parallelism is chosen and multiprocess</strong> – not installed</p>
</dd>
</dl>
<dl class="py method">
<dt id="pyungo.core.Graph.add_node">
<code class="sig-name descname">add_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">function</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.core.Graph.add_node" title="Permalink to this definition">¶</a></dt>
<dd><p>explicit method to add a node to the graph</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>function</strong> (<em>function</em>) – Python function attached to the node</p></li>
<li><p><strong>inputs</strong> (<em>list</em>) – List of inputs (Input, str, or dict)</p></li>
<li><p><strong>outputs</strong> (<em>list</em>) – List of outputs (Output or str)</p></li>
<li><p><strong>args</strong> (<em>list</em>) – List of optional args</p></li>
<li><p><strong>kwargs</strong> (<em>list</em>) – List of optional kwargs</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.calculate">
<code class="sig-name descname">calculate</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.core.Graph.calculate" title="Permalink to this definition">¶</a></dt>
<dd><p>run graph calculations</p>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.dag">
<em class="property">property </em><code class="sig-name descname">dag</code><a class="headerlink" href="#pyungo.core.Graph.dag" title="Permalink to this definition">¶</a></dt>
<dd><p>return the ordered nodes graph</p>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.data">
<em class="property">property </em><code class="sig-name descname">data</code><a class="headerlink" href="#pyungo.core.Graph.data" title="Permalink to this definition">¶</a></dt>
<dd><p>return the data of the graph (inputs + outputs)</p>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.register">
<code class="sig-name descname">register</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.core.Graph.register" title="Permalink to this definition">¶</a></dt>
<dd><p>register decorator</p>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.run_node">
<em class="property">static </em><code class="sig-name descname">run_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.core.Graph.run_node" title="Permalink to this definition">¶</a></dt>
<dd><p>run the node</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>node</strong> (<a class="reference internal" href="#pyungo.core.Node" title="pyungo.core.Node"><em>Node</em></a>) – The node to run</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>node id, node output values</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>results (tuple)</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.sim_inputs">
<em class="property">property </em><code class="sig-name descname">sim_inputs</code><a class="headerlink" href="#pyungo.core.Graph.sim_inputs" title="Permalink to this definition">¶</a></dt>
<dd><p>return input names (mapped) of every nodes</p>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.sim_kwargs">
<em class="property">property </em><code class="sig-name descname">sim_kwargs</code><a class="headerlink" href="#pyungo.core.Graph.sim_kwargs" title="Permalink to this definition">¶</a></dt>
<dd><p>return kwarg names (mapped) of every nodes</p>
</dd></dl>

<dl class="py method">
<dt id="pyungo.core.Graph.sim_outputs">
<em class="property">property </em><code class="sig-name descname">sim_outputs</code><a class="headerlink" href="#pyungo.core.Graph.sim_outputs" title="Permalink to this definition">¶</a></dt>
<dd><p>return output names (mapped) of every nodes</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="pyungo.io.Input">
<em class="property">class </em><code class="sig-prename descclassname">pyungo.io.</code><code class="sig-name descname">Input</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">map</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">meta</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">contract</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.io.Input" title="Permalink to this definition">¶</a></dt>
<dd><p>Object representing a function input</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) – The variable name of the input / output</p></li>
<li><p><strong>map</strong> (<em>str</em>) – Optional mapping name. This is the name referenced
in the data inputs / outputs</p></li>
<li><p><strong>meta</strong> (<em>dict</em>) – Not used yet</p></li>
<li><p><strong>contract</strong> (<em>str</em>) – Optional contract rule used by pycontracts</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt id="pyungo.io.Output">
<em class="property">class </em><code class="sig-prename descclassname">pyungo.io.</code><code class="sig-name descname">Output</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">map</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">meta</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">contract</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyungo.io.Output" title="Permalink to this definition">¶</a></dt>
<dd><p>Object representing a function output</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) – The variable name of the input / output</p></li>
<li><p><strong>map</strong> (<em>str</em>) – Optional mapping name. This is the name referenced
in the data inputs / outputs</p></li>
<li><p><strong>meta</strong> (<em>dict</em>) – Not used yet</p></li>
<li><p><strong>contract</strong> (<em>str</em>) – Optional contract rule used by pycontracts</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>


          </div>
          
        </div>
      </div>
    <div class="clearer"></div>
  </div>
    <div class="footer">
      &copy;2019, Cedric Leroy.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 3.1.0</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="../_sources/source/developer.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    
    <a href="https://github.com/cedricleroy/pyungo" class="github">
        <img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"  class="github"/>
    </a>
    

    
  </body>
</html>